package net.comm.shequ.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.blog.bean.BaseBlog;
import net.comm.param.bean.BaseProperty;
import net.comm.shequ.bean.BaseShequ;
import net.comm.shequ.bean.BaseWuye;
import net.comm.shequ.bean.BaseYewei;
import net.comm.util.StringUtil;

import org.apache.log4j.Logger;
import org.sakaiproject.db.api.SqlReader;

public class DbWuyeService implements SqlReader
{

	static Logger logger = Logger.getLogger(DbWuyeService.class.getName());

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{		
			
			int wuyeID 	= result.getInt(1);		//	物业ID
			int villageID 	= result.getInt(2);	//	所属社区ID
			String name = StringUtil.getValue(result.getString(3));	//	管理公司名称
			String info = StringUtil.getValue(result.getString(4));	//	简介
			String address = StringUtil.getValue(result.getString(5));	//	地址
			String tel = StringUtil.getValue(result.getString(6));	//	电话
			int pepoleNum 	= result.getInt(7);	//	管理处人数
			int chairman 	= result.getInt(8);	//	负责人
			String status = StringUtil.getValue(result.getString(9));	//	状态
			String mtime = StringUtil.getValue(result.getString(10));	//	最后修改时间

			// create the Resource from these fields
			return new BaseWuye(  wuyeID,  villageID,  name,  info, address,  tel,  pepoleNum,  chairman,
					 status,  mtime );
		}
		catch (SQLException e)
		{
			logger.error("读取表数据持久层失败！");
			return null;
		}
		
	}
}
